#ifndef UDPSOCKETBASE_H
#define UDPSOCKETBASE_H

#include <QObject>
#include <QUdpSocket>
#include <QDebug>

class UdpSocketBase : public QObject
{
    Q_OBJECT
public:
    explicit UdpSocketBase(QObject *parent = nullptr);

    virtual bool bind_multicast(QHostAddress ip, uint16_t port) = 0;
    virtual void quit_multicast() = 0;
    virtual qint64 send_msg(QByteArray msg, QString addr="", int port = 0) = 0;
    bool getIsConnect(){return isConnecting;}

    virtual ~UdpSocketBase();

signals:
    void signal_readMsg(QString,unsigned int,QByteArray);

protected:
    QUdpSocket *_sock;

    bool isConnecting = false;


};

#endif // UDPSOCKETBASE_H
